﻿using UnityEngine;

//Version 1.1
// 调整屏幕内容缩放(比例)大小

public class PageResize : MonoBehaviour
{
	[Tooltip("实际屏幕大小，硬件的分辨率")]
	public Vector2Int screen_size = new Vector2Int(1920, 1080); //实际屏幕大小
	[Tooltip("设计稿的大小，可拉伸图案")]
	public Vector2Int page_size = new Vector2Int(1920, 1080); // 设计稿的大小
	[Tooltip("是否执行缩放")]
	public bool if_resize = false;


	// Start is called before the first frame update
	void Start()
	{
		if (if_resize)
		{
			// 根据设计稿与设备的差别，缩放内容
			if (page_size.x != screen_size.x || page_size.y != screen_size.y)
			{
				transform.localScale = new Vector3((float)screen_size.x / (float)page_size.x, (float)screen_size.y / (float)page_size.y, 1);
			}
		}
	}

}
